import java.util.Scanner;

public class CityNameComparator {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("请输入第一个城市名: ");
        String city1 = scanner.nextLine();

        System.out.print("请输入第二个城市名: ");
        String city2 = scanner.nextLine();

        System.out.print("请输入第三个城市名: ");
        String city3 = scanner.nextLine();

        // 比较城市名并按顺序输出
        String[] cities = {city1, city2, city3};
        java.util.Arrays.sort(cities);

        System.out.println("按顺序输出的城市名:");
        for (String city : cities) {
            System.out.println(city);
        }
    }
}

